using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Summary description for CMSManagementPageBase
/// </summary>
public class CMSManagementPageBase : CMSPageBase
{
    public CMSManagementPageBase()
    {
        //
        // TODO: Add constructor logic here
        //
    }

    public void ShowSystemFeedback(string Heading, string Text, System.Drawing.Color Color)
    {
        string html = "<b><span style=\"color:#" + Color.R.ToString() + Color.G.ToString() + Color.B.ToString() + ";\">" + Heading + "</span></b><Br/>";
        html += Text;

        // TODO: show the feedback
        Response.Write(html);
    }
    public void ShowSystemFeedback(string Text)
    {
        ShowSystemFeedback(Text, "", System.Drawing.Color.Black);
    }

    protected override void OnPreInit(EventArgs e)
    {
        MembershipUser user = Membership.GetUser();
        if (System.IO.Path.GetFileName(Request.Url.LocalPath) != "signin.aspx")
        {
            if (user == null || user.UserName == null
            || (!User.IsInRole("administrator") && !User.IsInRole("manager")))
            Response.Redirect("~/manager/signin.aspx");
        }

        base.OnPreInit(e);

    }

    protected override void OnLoad(EventArgs e)
    {
        if (Request.QueryString["sf"] != null)
            ShowSystemFeedback(Request.QueryString["sf"]);

        if (Page.Header != null)
            Page.Title = "Tanash CMS";

        base.OnLoad(e);
    }

    protected override void Render(HtmlTextWriter writer)
    {

        base.Render(writer);
    }
}
